package com.tj.collection.db.enums;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @ClassName:
 * @Description:
 * @Author yuyanqi
 * @Create 2017/3/21 0021 下午 2:44
 */
public enum RoleKeyEnum {

    SUPERADMIN("SUPERADMIN", "超级管理员"),
    VIEW_ALL_DATA_PERMISSION("VIEW_ALL_DATA_PERMISSION", "查看所有数据权限"),
    TEAM_LEADER("TEAM_LEADER", "团长角色"),


    COLLECT_LEADER("COLLECT_LEADER", "催收主管"),
    THIRD_COLLECT_LEADER("THIRD_COLLECT_LEADER", "外催-催收主管"),
    COLLECT_STAFF("COLLECT_STAFF", "催收专员"),

    MULTIPLE_MERCHANT("MULTIPLE_MERCHANT", "MULTIPLE_MERCHANT"),//支持多商户的管理员
    ;

    private String type;

    private String desc;

    RoleKeyEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public String getType() {
        return type;
    }

    public RoleKeyEnum setType(String type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public RoleKeyEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static List<RoleKeyEnum> getCollectionAllPermissionEnum() {
        return Lists.newArrayList(RoleKeyEnum.SUPERADMIN, RoleKeyEnum.COLLECT_LEADER, RoleKeyEnum.THIRD_COLLECT_LEADER);
    }

    public static RoleKeyEnum getEnumByType(String type) {
        RoleKeyEnum RoleKeyEnum = null;
        for (RoleKeyEnum e : RoleKeyEnum.values()) {
            if (e.getType().equals(type)) {
                RoleKeyEnum = e;
            }
        }

        return RoleKeyEnum;
    }
}
